﻿using Elves;
using Pathfinding;
using Player;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ElvesNormal :ElvesStateBase,IStateBase
{

    private Transform target;

    ElvesMoveAI moveAI;

    public ElvesNormal(ElvesBody elves) : base(elves)
    {
        moveAI = new ElvesMoveAI(Elves,Elves.GetComponent<Seeker>());
    }

    public void GetState()
    {
        throw new System.NotImplementedException();
    }

    public void Interrupt()
    {
        throw new System.NotImplementedException();
    }

    public void OnEnter()
    {
        moveAI.StartPath();
        //InvokeRepeating("UpdatePath", 0.1f, 0.5f);
       // throw new System.NotImplementedException();
    }

    public void OnExit()
    {
        moveAI.EndPath();
        //CancelInvoke();
        //throw new System.NotImplementedException();
    }

    public void OnFixedUpdate()
    {
        moveAI.Move(target, elvesData.WalkSpeed * elvesData.LocalTimeScale,0.15f);
    }

    public void OnUpdate(params object[] obj)
    {
        //throw new System.NotImplementedException();
        target = (Transform)obj[0];
    }


}
